<?php
$this->breadcrumbs=array(
	Yii::t('backend','Nhóm thành viên') => array('index')
);
$this->menu = array(
	array('label'=>NHtml::icon('ss_add') . Yii::t('backend','Thêm'), 'url'=>array('create'))
); ?>

<?php $this->widget('zii.widgets.CListView', array(
	'id'=>'usergroup_list',
	'dataProvider'=>$dataProvider,
	'itemView'=>'_view',
	'itemsCssClass'=>'items clearfix',
	'sortableAttributes'=>array('id','name')
)); ?>

<div id="user_list"></div>

<?php
cs()->registerScript('module.user',"
	ajaxInlineTrigger($('#usergroup_list'), '.ajax-update-inline-trigger', function(){});
	$('body').on('click','#usergroup_list .listUser',function(){
		return ajaxLinkTrigger($(this), function(data){
			var id=($(this).attr('href').match(/listUser&id=\d+/g)).toString();
			location.hash = id;
			$('#user_list').html(data);
		});
	});
	$('.ajax-delete-trigger').on('click',function(){
		$.ajax({
			url:$(this).attr('href'),
			type:'POST',
			context:$(this),
			success:function(data){
				data = $.parseJSON(data);
				if(data.result=='success')
					$(this).parent().parent().html(data.message).show('fast').delay(2000).fadeOut(function(){\$(this).remove()});
				else
					alert(data.message);
			}
		});
		return false;
	})
");
?>

